import java.io.IOException;  
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
import org.apache.http.HttpStatus;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
  

  
public class RenRen {  
	
	public static void login() throws ClientProtocolException, IOException{
		HttpClient  httpClient =  new DefaultHttpClient();   
		 String url = "http://www.renren.com/PLogin.do";   
		  List<NameValuePair> formparams = new ArrayList<NameValuePair>();
	      formparams.add(new BasicNameValuePair("email", "529595068@qq.com"))  ;  
	      formparams.add( new BasicNameValuePair("password", "ZHANGFUYU1990")) ; 
	      UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
	        HttpPost httppost = new HttpPost(url);
	        httppost.setEntity(entity);
	        System.out.println(httppost.getURI());
	        httpClient.execute(httppost);
	        post();
	}
	
	
    public static void post() throws ClientProtocolException, IOException{    
  
        HttpClient  httpClient =  new DefaultHttpClient();    
          //去掉cookie设置，采用httpclient的默认cookie设置  
        String url = "http://www.renren.com/ContactInfo.do";    
        List<NameValuePair> formparams = new ArrayList<NameValuePair>();
        formparams.add(new BasicNameValuePair("deliver.outtype", "400400"))  ;  
        formparams.add(  new BasicNameValuePair("deliver.batch", "333"));
       
        UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8");
        HttpPost httppost = new HttpPost(url);
        httppost.setEntity(entity);
        System.out.println(httppost.getURI());
        httpClient.execute(httppost);
    }
      
public static void main(String[] args) throws ClientProtocolException, IOException{  
      new RenRen().post();
          
    }  
} 